#!/bin/sh
echo "Detecting host operating system"
host_os=`uname -s`
case $host_os in
    Linux*)
        echo "$host_os detected as host operating system"
        cp configure.in.linux configure.in
        echo "Running aclocal\n"
        aclocal
        echo "Running autoheader\n"
        autoheader
        echo "Running automake\n"
        automake --add-missing
        echo "Running autoconf\n"
        autoconf
        echo "If there were no errors reported, you should be able to run the configure script now\n"
    ;;
    Darwin*)
        echo "$host_os detected as host operating system"
        cp Makefile.am.osx Makefile.am
        cp src/Makefile.am.osx src/Makefile.am
        cp configure.in.osx configure.in        
        glibtoolize
        echo "Running aclocal\n"
        aclocal
        echo "Running autoheader\n"
        autoheader
        echo "Running automake\n"
        automake --add-missing
        echo "Running autoconf\n"
        autoconf
        echo "If there were no errors reported, you should be able to run the configure script now\n"
    ;;
    *)
        echo "$host_os not supported at this time"
    exit 0 ;;
esac
